// 04jyhs/orderAdmin/orderAdminDetail/orderAdminDetail.js
var co = require('../../../resource/js/common.js')
var MD5 = require("../../../resource/js/md5.js")
var app = getApp()
var appData = app.Data
var _this, _data, _orderID, _reload
Page({
   data: {
      orderList: [],
      schedule: '', //进度
   },
   onLoad: function (opt) {
      _this = this
      _data = this.data
      _orderID = opt.orderID
      _reload = opt.reload
      _this.get_order_detail_info(_orderID)
   },
   onShow:function(){
      if (_reload){
         _this.get_order_detail_info(_reload)
      }
   },
   //获取订单详情
   get_order_detail_info(Order_ID) {
      co.getJyhsApi("order/Order/getOrderDetails", {
         Order_ID: Order_ID
      }, function (res) {
         if (res.code == 0) {
            _this.setData({
               orderList: res.data
            })
            if (res.data.Order_Status == 0) { //未接单
               _this.setData({
                  schedule: 0
               })
            } else if (res.data.Order_Status == 1) { //已接单
               _this.setData({
                  schedule: 1
               })
            } else if (res.data.Order_Status == 2) { //已完成
               _this.setData({
                  schedule: 4
               })

            } else if (res.data.Order_Status == 3) { //已评价
               _this.setData({
                  schedule: 5
               })

            } else if (res.data.Order_Status == 4) { //已支付
               _this.setData({
                  schedule: 3
               })
            } else if (res.data.Order_Status == 5) { //待上门
               _this.setData({
                  schedule: 2
               })
            }
         }
      })
   },
   //更改指派
   updatePoint() {
      var Order_ID = _data.orderList.Order_ID
      wx.navigateTo({
         url: '/04jyhs/bizAdmin/pointSend/pointSend?Order_ID=' + Order_ID + '&Biz_ID=' + 91,
      })
   },
})